import { defineStore } from 'pinia';
import { ref } from 'vue';
import { getOnline, getUserById } from 'src/api/api';

export const useUserStore = defineStore('user', () => {
  const user = ref({});
  const getUser = async () => {
    user.value = (await getUserById()).data.data;
    return user.value;
  };
  const userOnline = ref({ id: '', client: '' });
  const getUserOnline = async () => {
    userOnline.value = (await getOnline()).data.data;
    return userOnline.value;
  };
  return {
    user,
    getUser,
    userOnline,
    getUserOnline,
  };
});
